package com.yunfeisoft.business.model;

import com.applet.base.ServiceModel;
import com.applet.utils.DateUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * ClassName: SmsHomeAdvertise
 * Description: 首页轮播广告表
 *
 * @Author: Jackie liu
 * Date: 2020-06-02
 */
@Entity
@Table(name = "SMS_HOME_ADVERTISE")
public class SmsHomeAdvertise extends ServiceModel implements Serializable {

    /**
     * Field serialVersionUID: 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 名称
     */
    @Column
    private String name;

    /**
     * 开始时间
     */
    @Column
    private Date startDate;

    /**
     * 结束时间
     */
    @Column
    private Date endDate;

    /**
     * 上下线状态：0->下线；1->上线
     */
    @Column
    private Integer status;

    public String getStatusStr() {
        if (status == null) {
            return null;
        }
        return AdvertiseStatusEnum.valueOf(status);
    }

    public enum AdvertiseStatusEnum {

        OFF(0, "下线"),
        ON(1, "上线");

        private int value;
        private String label;

        private AdvertiseStatusEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (SmsHomeAdvertise.AdvertiseStatusEnum loop : SmsHomeAdvertise.AdvertiseStatusEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }

    }

    /**
     * 轮播位置：0->PC首页轮播；1->app首页轮播
     */
    @Column
    private Integer type;

    public String getTypeStr() {
        if (type == null) {
            return null;
        }
        return AdvertiseTypeEnum.valueOf(type);
    }

    public enum AdvertiseTypeEnum {

        PC(0, "PC首页轮播"),
        APP(1, "APP首页轮播");

        private int value;
        private String label;

        private AdvertiseTypeEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (SmsHomeAdvertise.AdvertiseTypeEnum loop : SmsHomeAdvertise.AdvertiseTypeEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }

    }

    /**
     * 图片
     */
    @Column
    private String pic;

    /**
     * 点击数
     */
    @Column
    private Integer clickCount;

    /**
     * 下单数
     */
    @Column
    private Integer orderCount;

    /**
     * 链接地址
     */
    @Column
    private String url;

    /**
     * 备注
     */
    @Column
    private String note;

    /**
     * 排序
     */
    @Column
    private Integer sort;

    public String getStartDateStr () {
        if (startDate == null) {
            return null;
        }
        return DateUtils.dateTimeToString(startDate);
    }

    public String getEndDateStr () {
        if (endDate == null) {
            return null;
        }
        return DateUtils.dateTimeToString(endDate);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public Integer getClickCount() {
        return clickCount;
    }

    public void setClickCount(Integer clickCount) {
        this.clickCount = clickCount;
    }

    public Integer getOrderCount() {
        return orderCount;
    }

    public void setOrderCount(Integer orderCount) {
        this.orderCount = orderCount;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }


}